﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoLoL.Logic.Repositories;
using System.Collections.ObjectModel;
using AutoLoL.Entities;

namespace AutoLoL.Logic.Factories
{
    // Is this a factory pattern? No idea =)
    public class ItemFactory : IItemRepository
    {
        private static ItemFactory _instance;
        public static ItemFactory Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new ItemFactory();
                }

                return _instance;
            }
        }

        private IItemRepository _repository;

        private ItemFactory()
        {
        }

        public void SetRepository(IItemRepository repository)
        {
            _repository = repository;
        }

        public Item GetByItemId(int itemId)
        {
            return _repository.GetByItemId(itemId);
        }

        public ReadOnlyCollection<Item> GetAll()
        {
            return _repository.GetAll();
        }
    }
}
